import { request } from '../request';

/** 获取静态路由 */
export function fetchGetConstantRoutes() {
  return request<Api.Route.MenuRoute[]>({ url: '/api/v1/route/getConstantRoutes' });
}

/** 获取用户路由 */
export function fetchGetUserRoutes() {
  /*
  return {
    error: false,
    data: [
      {
        name: 'home',
        path: '/home',
        component: 'layout.base$view.home',
        meta: {
          title: '首页',
          localIcon: 'menu-dashboard'
        }
      },
      // {
      //   name: 'manage',
      //   path: '/manage',
      //   component: 'layout.base',
      //   meta: {
      //     title: '系统管理',
      //     icon: 'carbon:cloud-service-management'
      //   },
      //   children: [
      //     {
      //       name: 'manage_menu',
      //       path: '/manage/menu',
      //       component: 'view.manage_menu',
      //       meta: {
      //         title: '菜单管理',
      //         icon: 'material-symbols:route'
      //       }
      //     },
      //     {
      //       name: 'manage_role',
      //       path: '/manage/role',
      //       component: 'view.manage_role',
      //       meta: {
      //         title: '角色管理',
      //         icon: 'carbon:user-role'
      //       }
      //     },
      //     {
      //       name: 'manage_user',
      //       path: '/manage/user',
      //       component: 'view.manage_user',
      //       meta: {
      //         title: '用户管理',
      //         icon: 'ic:round-manage-accounts'
      //       }
      //     }
      //   ]
      // },
      {
        name: 'ticket-manage',
        path: '/ticket-manage',
        component: 'layout.base',
        meta: {
          title: '业务管理',
          localIcon: 'carbon-inventory-management'
        },
        children: [
          {
            name: 'ticket-manage_ticket',
            path: '/ticket-manage/ticket',
            component: 'view.ticket-manage_ticket',
            meta: {
              title: '工单管理',
              localIcon: 'lsicon-order-outline'
            }
          },
          {
            name: 'ticket-manage_device',
            path: '/ticket-manage/device',
            component: 'view.ticket-manage_device',
            meta: {
              title: '设备管理',
              localIcon: 'icon-park-solid-exclusive-gateway'
            }
          },
          {
            name: 'ticket-manage_vpn-template',
            path: '/ticket-manage/vpn-template',
            component: 'view.ticket-manage_vpn-template',
            meta: {
              title: '量子模板管理',
              localIcon: 'tabler-template'
            }
          },
          {
            name: 'ticket-manage_vpn',
            path: '/ticket-manage/vpn',
            component: 'view.ticket-manage_vpn',
            meta: {
              title: '量子配置管理',
              localIcon: 'carbon-vpn'
            }
          }
        ]
      },
      {
        name: 'map',
        path: '/map/:id',
        component: 'layout.blank$view.amap',
        meta: {
          title: '地图',
          localIcon: 'material-symbols-map-outline',
          hideInMenu: true,
          props: true
        }
      }
    ],
    code: '0',
    msg: '请求成功'
  };
  */
  return request<Api.Route.UserRoute>({
    url: '/api/v1/sys/getMenuList',
    method: 'get'
  });
}

/**
 * 判断访问的路由是否存在
 *
 * @param routeName 路由名称
 */
export function fetchIsRouteExist(routeName: string) {
  // return request<boolean>({
  //   url: '/api/v1/route/isRouteExist',
  //   method: 'post',
  //   data: { routeName }
  // });
  return {
    data: false,
    code: '0',
    msg: routeName
  };
}
